package com.wteam.dragon.system.aop.log.controller.pojo.bean;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.gitee.sunchenbin.mybatis.actable.annotation.*;
import com.gitee.sunchenbin.mybatis.actable.constants.MySqlTypeConstant;
import com.wteam.dragon.system.basebean.bean.BaseBean;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
/**
 * @author 陈晓辉
 * @date 2020-03-12
 */
@Data
@ToString
@Table(name = "log")
@TableName("log")
@EqualsAndHashCode(callSuper = true)
public class Log extends BaseBean {
    @IsKey
    @IsNotNull
    @IsAutoIncrement
    @TableId(type = IdType.AUTO)
    @ColumnType(MySqlTypeConstant.BIGINT)
    @Column(comment = "自增id")
    private Long id;

    @ColumnType(MySqlTypeConstant.VARCHAR)
    @Column(comment = "操作用户")
    private String username;

    @ColumnType(MySqlTypeConstant.VARCHAR)
    @Column(comment = "描述")
    private String description;


    @ColumnType(MySqlTypeConstant.VARCHAR)
    @Column(comment = "方法名")
    private String method;

    @ColumnType(MySqlTypeConstant.TEXT)
    @Column(comment = "参数")
    private String params;

    @ColumnType(MySqlTypeConstant.VARCHAR)
    @Column(comment = "日志类型")
    private String logType;

    @ColumnType(MySqlTypeConstant.VARCHAR)
    @Column(comment = "请求ip")
    private String requestIp;

    @ColumnType(MySqlTypeConstant.VARCHAR)
    @Column(comment = "地址")
    private String address;

    @ColumnType(MySqlTypeConstant.VARCHAR)
    @Column(comment = "浏览器")
    private String browser;

    @ColumnType(MySqlTypeConstant.BIGINT)
    @Column(comment = "请求耗时")
    private Long time;

    @ColumnType(MySqlTypeConstant.TEXT)
    @Column(comment = "异常详细")
    private byte[] exceptionDetail;

    @TableField(exist = false)
    private String detail;

    public Log(String logType, Long time) {
        this.logType = logType;
        this.time = time;
    }

    public Log() {
    }
}
